package FabricaConexiones;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class ConexionOracle {

    public static void main(String[] args) {
        String datos[][] = new String[10][8];
        int i = 0;
        Connection con = null;
        Statement stm = null;
        ResultSet rs = null;

        try {
            con = Conexion.obtenerConexion();
            stm = con.createStatement();
            rs = stm.executeQuery("SELECT * FROM CLIENTE");
            while (rs.next()) {
                datos[i][0] = rs.getString(1);
                datos[i][1] = rs.getString(2);
                datos[i][2] = rs.getString(3);
                datos[i][3] = rs.getString(4);
                datos[i][4] = rs.getString(5);
                datos[i][5] = rs.getString(6);
                datos[i][6] = rs.getString(7);
                datos[i][7] = rs.getString(8);
                i++;
            }
        } catch (SQLException ex) {
            ex.printStackTrace();
        } finally {
            try {
                stm.close();
                con.close();
            } catch (SQLException ex) {
                System.out.println("No se cerro correctamente la conexion ");
            }
        }
        System.out.println("Los datos obtenidos son: \n");
        for (int j = 0; j < i; j++) {
            System.out.println("Cliente id: " + datos[j][0]);
            System.out.println("Nombre: " + datos[j][1]);
            System.out.println("Apellido paterno: " + datos[j][2]);
            System.out.println("Apellido materno: " + datos[j][3]);
            System.out.println("RFC: " + datos[j][4]);
            System.out.println("E-mail: " + datos[j][5]);
            System.out.println("Direccion: " + datos[j][6]);
            System.out.println("Tarjeta credito id: " + datos[j][7]);
        }

    }
}
